<?php

/**
 * @author Martin Pernica
 * @copyright 2009
 */

$count_reply = $db->query("SELECT COUNT(id) as celkem FROM {prefix}forum_prispevky");
$count_reply = $count_reply->fetch_array();
$count_user = $db->query("SELECT COUNT(id) FROM {prefix}users");
$count_user = $count_user->fetch_array();
$count_themes = $db->query("SELECT COUNT(id) FROM {prefix}forum_temata");
$count_themes = $count_themes->fetch_array();
$last_user = $db->query("SELECT id, display_name FROM {prefix}users ORDER BY id DESC LIMIT 1");
$last_user = $last_user->fetch_array();

$visitors = $visitors_online->count_users_component('forum%');
$logged_visitors = $visitors_online->count_logged_users_component('forum%');

$data = $visitors_online->get_uid();
while ($uid = $data->fetch_array()) {
    $users .= '<a href="' . $GLOBALS['url'] . 'user/single/' . $uid[0] . '">' .
        getUsernameFromDB($uid[0]) . '</a> &bull; ';
}

echo '<div id="forum_stats"><h3>Statistiky </h3>';
echo '<p>Celkem uživatelů: <strong>' . $count_user[0] .
    '</strong>  Poslední uživatel: <strong><a href="' . $GLOBALS['url'] .
    'user/single/' . $last_user[0] . '">' . $last_user[1] . '</a></strong></p>';
echo '<p>Fórum právě prohlíží <strong>' . $visitors .
    '</strong> uživatelů z toho <strong>' . $logged_visitors .
    '</strong> přihlášených.</p>';
echo '<p> - '.$users.'</p>';
echo '<p>Celkem zpráv: <strong>' . $count_reply[0] .
    '</strong>  Celkem témat: <strong>' . $count_themes[0] . '</strong></p></div>';

?>